package pl.edu.pw.perg.compinfodb.dao;

import java.util.List;

import org.hibernate.Query;
import org.hibernate.criterion.Expression;

import pl.edu.pw.perg.compinfodb.entities.VirtualElement;

public class VirtualElementDAO extends GenericSpringDAO<VirtualElement> implements IVirtualElementDAO{

	/* (non-Javadoc)
	 * @see pl.edu.pw.perg.compinfodb.dao.IElementDAO#findRoots()
	 */
	public List<VirtualElement> findRoots(){
		return findByCriteria(Expression.isNull("parent"));
	}
	@Override
	public void deleteAll() {
	  Query q = getSession().createQuery("delete from VirtualElement"); 
	  q.executeUpdate();
	}
	
}
